<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateCartsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('carts', function (Blueprint $table) {
            $table-> engine = 'innoDb';
            $table-> increments('id');
            $table-> integer('spu_id')->comment('商品的spu_id');
            $table-> integer('sku_id')->comment('商品的sku_id');
            $table-> integer('amount')->comment('商品的数量');
            $table-> integer('user_id')->comment('添加购物车的人');
            $table-> timestamps();
        });
        DB::statement("ALTER TABLE `wx_carts` comment'购物车表'"); // 表注释
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('carts');
    }
}
